/*
 * PauseAction.java
 *
 * Created on June 22, 2005, 7:36 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */
package com.bff.slimserver.musicjukebox.lib.actions;

import com.bff.slimserver.musicjukebox.lib.JukeboxProperties;
import com.bff.slimserver.musicjukebox.lib.events.PlayerChosenEvent;
import com.bff.slimserver.musicjukebox.lib.events.PlayerChosenListener;
import com.bff.bjj.utils.Resources;
import com.bff.bjj.utils.Resources.ICON_KEY;
import java.awt.event.ActionEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import org.bff.slimserver.SlimPlayer;
import org.bff.slimserver.exception.SlimConnectionException;

/**
 *
 * @author Bill
 */
public class PauseAction extends PlayerAction {

    /** Creates a new instance of StopAction */
    public PauseAction(SlimPlayer player) {
        super(player);

        putValue(Action.NAME, Resources.getMessage(Resources.LABEL_KEY.ACTION_PAUSE_NAME));
        putValue(Action.SMALL_ICON, Resources.getIcon(ICON_KEY.ACTION_PAUSE));
        putValue(Action.MNEMONIC_KEY, Resources.getKeyEvent(Resources.KEYEVENT_KEY.ACTION_PAUSE));
        putValue(Action.ACCELERATOR_KEY, Resources.getKeystroke(Resources.KEYSTROKE_KEY.KEYSTROKE_PAUSE));
        putValue(Action.SHORT_DESCRIPTION, Resources.getMessage(Resources.LABEL_KEY.ACTION_PAUSE_SHORT_DESC));
    }

    @Override
    public void actionPerformed(ActionEvent evt) {
        try {
            getPlayer().pause();
        } catch (SlimConnectionException ex) {
            Logger.getLogger(PauseAction.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}